# Maintainer: Christian Rebischke <chris.rebischke@archlinux.org>
# Contriubutor: Jamie Magee <jamie dot magee at gmail dot com>

pkgname=gitsign
pkgver=0.7.1
pkgrel=1
pkgdesc='Keyless Git signing using Sigstore'
arch=('loong64' 'x86_64')
url='https://github.com/sigstore/gitsign'
license=(APACHE)
makedepends=(go)
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/sigstore/${pkgname}/archive/refs/tags/v${pkgver}.tar.gz")
b2sums=('d5d95c6870f3837bbbd91ed03127392244ff06758f06e8cfcf250ef430cf6a43487d4810d21c977e7992691aeafaea8e39f6fb56e261d42e29f540a1bc265d83')

build() {
  cd $pkgname-$pkgver
  export CGO_LDFLAGS="${LDFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
  make build-all
}

package() {
  cd $pkgname-$pkgver

  install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
